package com.bjpowernode.controller;

import com.bjpowernode.result.AxisData;
import com.bjpowernode.result.NameValueData;
import com.bjpowernode.result.OverViewData;
import com.bjpowernode.result.R;
import com.bjpowernode.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StatisticController {
    @Resource
    private StatisticService statisticService;

    @GetMapping(value = "/api/overview")
    public R overview() {
        OverViewData overViewData = statisticService.getOverViewData();
        return R.OK(overViewData);
    }

    @GetMapping(value = "/api/funel")
    public R funel() {
        List<NameValueData> nameValueDataList = statisticService.getFunelData();
        return R.OK(nameValueDataList);
    }

    @GetMapping(value = "/api/pie")
    public R pie() {
        List<NameValueData> nameValueDataList = statisticService.getPieData();
        return R.OK(nameValueDataList);
    }

    @GetMapping(value = "/api/activity/bar")
    public R activityBar() {
        // [10, 0, 17, 22, 18, 0, 11]
        Integer[] activityBarDataArr = statisticService.getBarData();
        return R.OK(activityBarDataArr);
    }

    @GetMapping(value = "/api/clue/bar")
    public R clueBar() {
        AxisData axisData = statisticService.getClueBarData();
        return R.OK(axisData);
    }

}
